package com.seahorse.youliao.controller;

import com.seahorse.youliao.service.entity.User;
import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @ProjectName: youliao
 * @Package: com.seahorse.youliao.controller
 * @ClassName: UserController
 * @Description: 用户控制类
 * @author:songqiang
 * @Date:2020-01-10 11:25
 **/
@Api(value = "UserController", tags = "spring security用户测试")
@RestController
@RequestMapping("user")
public class UserController {



    @PreAuthorize("hasAuthority('sys:user:view1')")
    @GetMapping(value="/findAll")
    public String findAll() {
        return "the findAll service is called success.";
    }

    @PreAuthorize("hasAuthority('sys:user:edit')")
    @PostMapping(value="/edit")
    public String edit(@RequestBody User u) {
        return "the edit service is called success.";
    }

    @PreAuthorize("hasAuthority('sys:user:delete')")
    @GetMapping(value="/delete")
    public String delete() {
        return "the delete service is called success.";
    }

}
